﻿<%@ Page Title="instock" Language="C#" MasterPageFile="~/EasyUI.master" AutoEventWireup="true" CodeBehind="List.aspx.cs" Inherits="jnxc.Web.instock.List" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

     <script type="text/javascript">

         $(function () {
             InitGird();             
         });
         //初始化表格
         function InitGird() {
             $('#tt').datagrid({
                 title: '操作记录', //表格标题
                 url: 'GetInstock.ashx', //请求数据的页面
                 sortName: 'intime', //排序字段
                 idField: 'inid', //标识字段,主键
                 iconCls: '', //标题左边的图标
                 width: '100%', //宽度
                 //height: $(parent.document).find("#mainPanle").height() - 35 > 0 ? $(parent.document).find("#mainPanle").height() - 35 : 500, //高度
                 nowrap: false, //是否换行，True 就会把数据显示在一行里
                 striped: true, //True 奇偶行使用不同背景色
                 collapsible: false, //可折叠
                 sortOrder: 'desc', //排序类型
                 remoteSort: true, //定义是否从服务器给数据排序
                 fitColumns: true,
                 method: 'post',
                 columns: [[
                     //{ field: 'ckb', checkbox: true },
                     { title: '编号', field: 'mbh', width: 150, sortable: true },
                     { title: '名称', field: 'mname', width: 150 },
                     { title: '型号', field: 'mtype', width: 120 },
                     { title: '操作时间', field: 'intime', width: 150 },
                     { title: '数量', field: 'snum', width: 150 },
                     {
                         title: '操作类型', field: 'otype', width: 150, formatter: function (value, row, index) {
                             if (row.otype==0) {
                                 return "入库";
                             } else {
                                 return "出库";
                             }
                         }
                     }
                     
                 ]],
                 toolbar: "#tab_toolbar",
                 queryParams: { "action": "query" },
                 pagination: true, //是否开启分页
                 pageNumber: 1, //默认索引页
                 pageSize: 20, //默认一页数据条数
                 rownumbers: true //行号
             });


         }         
         function getQueryParams(queryParams) {
             var StartTime = $("#StartTime").datetimebox("getValue");
             var EndTime = $("#EndTime").datetimebox("getValue");
             var mname = $("#mname").val();
             //var otype = document.getElementById("otype").value;
             var otype = $("#otype").combobox("getValue");
             queryParams.StartTime = StartTime;
             queryParams.EndTime = EndTime;
             queryParams.mname = mname;
             queryParams.otype = otype;

             return queryParams;

         }
         //增加查询参数，重新加载表格  
         function reloadgrid() {

             //查询参数直接添加在queryParams中      
             var queryParams = $('#tt').datagrid('options').queryParams;
             getQueryParams(queryParams);
             $('#tt').datagrid('options').queryParams = queryParams;
             $("#tt").datagrid('reload');

         }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table id="tt">
    </table>
    <div id="tab_toolbar" style="padding: 4px;">
        <table cellpadding="0" cellspacing="0" style="width: 100%">
            <tr>
                
                <td style="padding-left: 15px">
                    <div>  
           时间从:  
           <input id="StartTime" class ="easyui-datetimebox" style="width: 150px" />  
           到:  
           <input id="EndTime" class="easyui-datetimebox" style="width: 150px" />   
          名称:   
           <input id="mname" class="easyui-validatebox"/>   
           按操作：  
             <select id="otype" class="easyui-combobox" name="otype" style="width: 150px;" panelheight="auto"  >
                 <option value="2">所有记录</option>   
    <option value="0">入库记录</option>
                 <option value="1">出库记录</option>
             </select>  
           <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="reloadgrid()">查找</a>  
       </div>                   
                </td>
            </tr>
        </table>
    </div>   
</asp:Content>
